// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import QtDesktop 0.1
import ".."

Rectangle {

    property int dateInSeconds: monthCalendarModel.dateInSeconds
    property int hour: monthCalendarModel.hour
    property int minute: monthCalendarModel.minute
    signal dateChanged

    width: 120
    height: 40
    border.width: 1
    border.color: "lightgray"
    radius: 3

    Row {
        spacing: 5
        SpinBox {
            id: hours_element
            width: 50

            minimumValue: 0
            maximumValue: 23
            value: monthCalendarModel.hour

            onValueChanged: {
                if(monthCalendarModel.hour !== value)
                    monthCalendarModel.hour = value
            }
            Keys.onPressed: {
                if (event.key == Qt.Key_Escape) {
                    dateChanged()
                } else
                    if (event.key == Qt.Key_Enter) {
                        dateChanged()
                    }
            }
        }
        SpinBox {
            id: minutes_element
            width: 50

            minimumValue: 0
            maximumValue: 59
            value: monthCalendarModel.minute

            onValueChanged: {
                if(monthCalendarModel.minute !== value)
                    monthCalendarModel.minute = value
            }
            Keys.onPressed: {
                if (event.key == Qt.Key_Escape) {
                    dateChanged()
                } else
                    if (event.key == Qt.Key_Enter) {
                        dateChanged()
                    }
            }
        }
    }
}
